-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate configMerge and scaleMerge helpers #6022
Deprecate configMerge and scaleMerge helpers #6022
Conversation
These methods shouldn't have been public since they are specific to the chart controller internal logic. Note that this scale custom merging will be removed in v3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it may be helpful to add the jsdocs. I agree they're not required. I find them helpful sometimes as a newcomer to the codebase especially in an loosely typed language like ecmascript
I removed the explicit clone of the first argument since it's already done by @benmccann I also added short header comments which I hope help to understand why these methods. I would not spend more effort commenting this code since it should disappear in v3 and simply replaced by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of bytes can be saved, nothing else pops out.
Hi, quick question from a rather new user of chartjs. Context: In order to do so I currently use the "configMerge" helper so that I can merge a default conf object with a user defined object prior to creating the chart (using the merged result as its "options" param). I understand why you say these are supposed to be private because they are "specific to the chart controller internal logic" but I thought it was a good thing they were exposed as helpers for cases like mine because I'm actually counting on the fact it has the same logic as the controller so that the conf passed to the chart constructor remain properly defined. Question: Thanks. |
@Lekishor can you just use |
@benmccann I could use |
I'm not sure why you need to rely on those methods, can share your code?
These methods are still public but deprecated. They exist only because of a wrong design of the scale options and we don't want to provide support for using them externally. The deprecation is to discourage users to rely on those methods. In v3, We are not going to un-deprecate these 2 methods but you can safely continue to use them until v3. |
@simonbrunel If scales is going to change and work as any other option in V3 then ok I won't need any other method that About my code, I made a simple factory allowing me to create a chartjs graph and some surrounding HTML objects with a single call to a create method instead of rewriting everything every time.
But I also give the opportunity for a user to send its own options object to alter the default options, so a simple example would be :
In the end I just want a single objects with all my keys merged properly to send to the Chart constructor and that was what I used |
@Lekishor why don't you use |
@simonbrunel Hum, to be honest I did not thought about using Chart.defaults.* for this. What I call my own default conf is something that is in fact modular and will change for almost each call made to my factory depending on the "options" requested as param (scales, zoom etc.) therefore it was more something to complete the user defined conf before creating the chart rather than being the actual setting of Chart.defaults. That way, the original Chart.defaults options were still there and merged with my own in the end. I wanted to merge things not replace the original default options so I coded this in order to alter the user conf passed to the graph instead. Anyway, I think I'll go back to read the doc I might have missed something and give it a try at some point before the release of the V3 and see what happens. Thank you for the answers / suggestions |
These methods shouldn't have been public since they are specific to the chart controller internal logic. Note that this scale custom merging will be removed in v3.
These methods shouldn't have been public since they are specific to the chart controller internal logic. Note that this scale custom merging will be removed in v3.
Closes #5995 (private methods don't need jsdoc).